package com.apes.fico.engine.model;

import com.apes.fico.masterdata.gl.model.AccountingVoucherType;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * @program: apestech
 * @description: 凭证模板组
 * @author: Chengxm
 * @create: 2019-01-24 15:42
 **/
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = VoucherTemplateGroup.CONST_TABLE_NAME)
public class VoucherTemplateGroup extends Model {
    public final static String CONST_TABLE_NAME ="fin_voucher_template_group";
    @Id
    @Column(name = "id", length = 8)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "凭证模板组")
    @Comment("编码")
    private String id;

    @Comment("名称")
    @Column(name = "name", nullable = false, length = 64)
    private String name;

    @Comment("描述")
    @Column(name = "description")
    private String description;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "acc_voucher_type_id", referencedColumnName = "id", nullable = false)
    @Comment("凭证类型")
    private AccountingVoucherType accountingVoucherType;

}
